import { Vec2 } from "cc";

/**
 * @name 节点工具类
 * @author qianShang
 * @version 20230831
 */
export default class NodeUtil{
    private static _Ins: NodeUtil;
    public static get Ins() {
        if (this._Ins == null) {
            this._Ins = new NodeUtil();
        }
        return this._Ins;
    }
    /**
     * 判断2个节点是否相交
     * @param node1 节点1
     * @param node2 节点2 
     * @param k 大小系数：值越大，矩形越小，判断范围越小
     * @returns 是否相交
     */
    static isNodeRect(node1:Node, node2: Node, k: number = 1): boolean {
        // let pos1 = node1.convertToWorldSpaceAR(Vec2.ZERO);
        // let pos2 = node2.convertToWorldSpaceAR(Vec2.ZERO);
        // let rect1 = cc.rect(pos1.x - node1.width / 2, pos1.y - node1.height / 2, node1.width / k, node1.height / k);
        // let rect2 = cc.rect(pos2.x - node2.width / 2, pos2.y - node2.height / 2, node2.width / k, node2.height / k);
        // return cc.Intersection.rectRect(rect1, rect2);
        return false;
    }
}